package PTA.ch06;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class fn01 {

    /*covnertStringToList函数代码*/

    /*remove函数代码*/

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextLine()){
            List<String> list = convertStringToList(sc.nextLine());
            System.out.println(list);
            String word = sc.nextLine();
            remove(list,word);
            System.out.println(list);
        }
        sc.close();
    }

    public static List<String> convertStringToList(String line) {
        List<String> list = new ArrayList<String>();
        String[] s = line.split("\\s+");
        for(int i=0;i<s.length;i++){
            list.add(s[i]);
        }
        return list;
    }
    public static void remove(List<String> list, String str){
  for(int j=0;j< list.size();){
      if(list.get(j).equals(str)){
          list.remove(j);
          j=0;
      }else{
          j++;
      }
  }
    }
}



